<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:composition template="/template/layout.xhtml">
		<ui:define name="conteudo">
		<br/><br/>
		<div id="path">
			<h1>Fórum</h1>
			<hr />
			<h:form>
				<h3>Tópicos</h3>
				<a href="../forum/novo.xhtml">Novo Tópico</a>

				<p:dataTable id="basic" var="topico" value="#{forumBean.topicos}">  
				        <p:column>  
				            <f:facet name="header">  
				                    Tópico  
				            </f:facet>
				            <h:commandLink value="#{topico.titulo}" action="#{forumBean.topicoPage}">
				            	<f:setPropertyActionListener target="#{forumBean.topico}" value="#{topico}" />				            	
				            </h:commandLink>
				        </p:column>
				        <p:column>  
				            <f:facet name="header">  
				                    Respostas
				            </f:facet>  
				            <h:outputText value="#{topico.sizeMensagens}" />  
				        </p:column>   				 
      					<p:column>  
				            <f:facet name="header">
				            		Autor
				            </f:facet>  
				            <h:outputText value="#{topico.usuario.nome}" />
				            <br/>
				            <h:outputText value="#{topico.dataHora}" />  
				        </p:column>
				        <p:column>  
				            <f:facet name="header">
				            		Última resposta
				            </f:facet>
				            <h:outputText value="#{topico.ultMensagem.usuario.nome}" />  
				              
				        </p:column>
				         
				    </p:dataTable>  
			</h:form>
			
		</div>
		</ui:define>
	</ui:composition>
</html>